<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="5" :lg="7" :md="8" :sm="24">
            <a-form-item label="会议组名称">
              <j-input placeholder="请输入会议组名称" v-model="queryParam.groupName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="专题类型">
              <j-dict-select-tag v-model="queryParam.topicType" dictCode="sc_situation_index_catalog,catalog_name,catalog_code" placeholder="请选择专题类型" />
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="会议类型">
              <j-dict-select-tag v-model="queryParam.groupType" placeholder="请选择会议类型" />
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="选择标签">
              <j-dict-select-tag v-model="queryParam.groupType" placeholder="请选择标签" />
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete" />删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down" />
        </a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" class="j-table-force-nowrap" @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>
        <template slot="topicType" slot-scope="text">
          <span>{{topicTypeShow(text)}}</span>
        </template>

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多
              <a-icon type="down" />
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <sc-subject-meeting-group-modal ref="modalForm" @ok="modalFormOk"></sc-subject-meeting-group-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ScSubjectMeetingGroupModal from './modules/ScSubjectMeetingGroupModal'

export default {
  name: 'ScSubjectMeetingGroupMana',
  components: {
    ScSubjectMeetingGroupModal
  },
  mixins: [JeecgListMixin, mixinDevice],
  data() {
    return {
      description: '会议组信息表管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '会议组名称',
          align: 'center',
          dataIndex: 'groupName'
        },
        {
          title: '成员人数',
          align: 'center',
          dataIndex: 'membersCount',
          width: 160
        },
        {
          title: '专题类型',
          align: 'center',
          dataIndex: 'topicType',
          scopedSlots: { customRender: 'topicType' }
        },
        {
          title: '会议类型',
          align: 'center',
          dataIndex: 'groupType'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 220,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/subject/scSubjectMeetingGroup/list', // 分页列表查询
        delete: '/subject/scSubjectMeetingGroup/delete', // id删除
        deleteBatch: '/subject/scSubjectMeetingGroup/deleteBatch', // 批量删除
        exportXlsUrl: '/subject/scSubjectMeetingGroup/exportXls',
        importExcelUrl: '/subject/scSubjectMeetingGroup/importExcel'
      },
      dictOptions: {},
      superFieldList: []
    }
  },
  computed: {
  },
  created() {
    this.getSuperFieldList()
  },
  methods: {
    topicTypeShow(val) {
      switch (val) {
        case 'A03':
          return '疫情防控'
        case 'A17':
          return '安全生产'
        case 'A14':
          return '市场监管'
        case 'A02':
          return '政务服务'
        case 'A20':
          return '森林防火'
        case 'A15':
          return '能源低碳'
        case 'A07':
          return '经济发展'
        case 'A16':
          return '日常调度'
        case 'A04':
          return '党建引领'
        case 'A08':
          return '民生保障'
        case 'A10':
          return '生态环境'
        case 'A19':
          return '地质灾害'
        case 'A11':
          return '文化旅游'
        case 'A18':
          return '防汛防台'
        case 'A05':
          return '城市运行'
        case 'A06':
          return '社会治理'
        case 'A12':
          return '智慧海洋'
        case 'A21':
          return '非煤矿山'
        case 'A13':
          return '公共卫生'
        case 'A01':
          return '数说烟台'
        case 'A09':
          return '交通运行'
        default:
          return val
      }
    },
    initDictConfig() {
    },
    // 新增弹窗
    getSuperFieldList() {
      const fieldList = []
      fieldList.push({ type: 'string', value: 'groupName', text: '会议名称' })
      fieldList.push({ type: 'string', value: 'groubmembers', text: '成员人数' })
      fieldList.push({ type: 'string', value: 'topicType', text: '专题类型', dictCode: 'sc_situation_index_catalog,catalog_name,catalog_code' })
      fieldList.push({ type: 'string', value: 'groupType', text: '会议类型' })
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
